<?php

namespace App\Models\Application;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class UploadTemplateHistory
 * @package App\Models\Application
 * @version August 6, 2018, 6:15 pm CST
 *
 * @property \App\Models\Application\Paneltpl paneltpl
 * @property \App\Models\Application\Administrator administrator
 * @property string upload_no
 * @property integer paneltpl_id
 * @property string url
 * @property string size
 * @property integer user_id
 */
class UploadTemplateHistory extends Model
{
    use SoftDeletes;


    public $table = 'upload_template_histories';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'upload_no',
        'paneltpl_id',
        'url',
        'size',
        'user_id'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'upload_no' => 'string',
        'paneltpl_id' => 'integer',
        'url' => 'string',
        'size' => 'string',
        'user_id' => 'integer'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'upload_no' => 'required|max:100',
        'user_id' => 'required'
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function paneltpl()
    {
        return $this->hasOne(\App\Models\Application\Paneltpl::class, 'id', 'paneltpl_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    // public function administrator()
    // {
    //     //use App\Models\Admin\AdminUser;

    //     return $this->hasOne(\App\Models\Admin\AdminUser::class, 'id', 'user_id');
    // }
}
